// 1.首先是一个普通的创建div的一个类
var CreateDiv = function(html) {
    this.html = html;
    this.init();
}

CreateDiv.prototype.init = function() {
    var div = document.createElement('div');
    div.innerHTML = this.html;
    document.body.appendChild(div);
}

// 引入代理类proxySingletonCreateDiv
var ProxySingletonCreateDiv = (function() {
    var instance;
    return function(html) {
        if(!instance) {
            instance = new CreateDiv(html);
        }
        return instance;
    }
})();

var a = new ProxySingletonCreateDiv('A');
var b = new ProxySingletonCreateDiv('B');

alert(a===b);